#include "pJoint.h"
#include "pBody.h"
#include "physics.h"
#include "template.h"

using namespace Tmpl8;
using namespace Tmpl8;
// debug draw

pJoint::pJoint( unsigned int aIndex, b2Joint* aJoint, pBody* aBody1, pBody* aBody2 )
: pEntity(aIndex)
{
	mJoint = aJoint;
	mBody1 = aBody1;
	mBody2 = aBody2;
}

void pJoint::Draw()
{
	vector3 pos1 = (mBody1->GetPosition() * SCALE_OUT) - *mPhysics->GetOffset();
	vector3 pos2 = (mBody2->GetPosition() * SCALE_OUT) - *mPhysics->GetOffset();
//	LineDraw(pos1, pos2, vector3(1.0f, 1.0f, 1.0f));
}

Tmpl8::vector3 Tmpl8::pJoint::GetPosition()
{
	return (mBody1->GetPosition() + mBody2->GetPosition() / 2.0f);
}

void Tmpl8::pJoint::Tick()
{

}